import java.util.concurrent.Semaphore;

public class Demo9 {
    public static void main(String[] args) throws InterruptedException {
        Semaphore semaphore=new Semaphore(4);
        semaphore.acquire();
        System.out.println("计数器-1");
        semaphore.acquire();
        System.out.println("计数器-1");
        semaphore.acquire();
        System.out.println("计数器-1");
        semaphore.acquire();
        System.out.println("计数器-1");
        semaphore.release();
        semaphore.acquire();
        System.out.println("我喜欢你");





    }
}
